<template>
	<view class="bg">
		<u-navbar :title="title" placeholder :autoBack="true" leftIconColor="#E6A5B4" bgColor="#FFFFFF"
			:titleStyle="titleStyle">
		</u-navbar>
		<view class="centV">
			<rich-text :nodes="content"></rich-text>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				titleStyle: {
					"color": "#ffffff"
				},
				title: '',
				code: '',
				content: '',
			}
		},
		onLoad(e) {
			if (e.type == 1) {//充值须知
				this.code = 'chongzhixuzhi';
			} else if (e.type == 2) {//协议与规则
				this.code = 'xieyiyuguize';
			} else if (e.type == 3) {//隐私协议
				this.code = 'yinsixieyi';
			} else if (e.type == 4) {//购买协议
				this.code = 'goumaixieyi';
			} else if (e.type == 5) {//联系客服
				this.code = 'lianxikefu';
			}
			this.getAgreement();
		},
		methods: {
			getAgreement() {
				this.$api.getAgreement({
					code:this.code
				}).then((res) => {
					this.title = res.name;
					this.content = res.content;
				}).catch((e) => {
					uni.$u.toast("请求失败");
				})
			}
		}
	}
</script>

<style>
	.bg {
		display: flex;
		flex-direction: column;
	}

	.centV {
		flex: 1;
		margin-left: 30rpx;
		margin-right: 30rpx;
		margin-top: 30rpx;
		margin-bottom: 30rpx;
		color: #fff;
	}
</style>
